﻿using System;
using Glue.Converters;
using Xunit;

namespace GlueTests.BaseConverterTests
{
    public class When_mapping_between_nullables
    {
        private readonly QuickConverter<int?, string> converter;

        public When_mapping_between_nullables()
        {
            converter = new QuickConverter<int?,String>(x=> "",y=>0);
            
        }

        [Fact]
        public void Should_not_throw_exceptions_towards_nullable()
        {
            converter.Map(1, "");
        }

        [Fact]
        public void Should_not_throw_exceptions_away_from_nullable()
        {
            converter.Map("", 1);
        }

        [Fact]
        public void Should_not_throw_exceptions_away_from_nullable_even_if_from_object_is_null()
        {
            converter.Map(null, 1);
        }
    }
}
